package cn.com.haopt;

import cn.com.haopt.common.config.UdpServerConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.concurrent.*;

/**
 * @author haopt
 * @version 1.0
 * @date 2021/4/25 11:57
 */
@Component
public class RunServer implements CommandLineRunner {
    @Autowired
    private RunServer runServer;


    @Override
    public void run(String... args) {
        ThreadPoolExecutor executorService = new ThreadPoolExecutor(
                1,
                1,
                10,
                TimeUnit.SECONDS,
                new LinkedBlockingQueue<Runnable>(3),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.DiscardPolicy());
        executorService.execute((Runnable) runServer);
    }
}
